package cn.wolfcode.trip.base.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;

import java.util.Date;

@Getter@Setter
public class StrategyComment extends BaseDomain{
    /**
     * 0 普通
     * 1 推荐
     * -1 禁用
     */
    public static final int STATE_COMMON=0;
    public static final int STATE_HOT=1;
    public static final int STATE_DISABLE=-1;
    //评论人
    private User user;
    //创建时间
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date createTime;
    //评论内容
    private String content;
    //评论图片
    private String imgUrls;
    //星星数量
    private Integer starNum;
    //大攻略
    private Strategy strategy;
    //状态
    private Integer state=STATE_COMMON;
    //评论推荐时间
    private Date commendTime;

    //获取评论图片url
    public String[] getImgArr(){
        if (StringUtils.hasLength(imgUrls)) {
            return imgUrls.split(";");
        }
        return null;
    }



}